# -*- coding: utf-8 -*-
from datetime import timedelta
from airflow.operators.dummy_operator import DummyOperator
from datetime import timedelta, datetime

from jms.dm import jms_dm__dm_waybill_collect_intime_detail
from jms.doris.jms_dwd.dwd_waybill_in_time.dwd_waybill_collect_intime import doris_jms_dwd__dwd_waybill_collect_intime
from jms.doris.jms_dwd.dwd_waybill_in_time.dwd_waybill_collect_intime_plan import \
    doris_jms_dwd__dwd_waybill_collect_intime_plan
from jms.doris.jms_dwd.dwd_waybill_in_time.dwd_waybill_collect_intime_plan_agg import \
    doris_jms_dwd__dwd_waybill_collect_intime_plan_agg
from jms.doris.jms_dwd.dwd_waybill_in_time.dwd_waybill_collect_intime_taking_agg import \
    doris_jms_dwd__dwd_waybill_collect_intime_taking_agg

doris_jms_dwd__dwd_waybill_in_time = DummyOperator(
    task_id='doris_jms_dwd__dwd_waybill_in_time',
    pool='unlimited_pool',
    email=['guoruiling@jtexpress.com','yl_bigdata@yl-scm.com'],
    priority_weight=0,
    # sla=timedelta(hours=5),
    # execution_timeout=max(datetime.now().replace(hour=8, minute=20, second=0) - datetime.now(), timedelta(seconds=1)),
    execution_timeout=timedelta(minutes=30),
)


doris_jms_dwd__dwd_waybill_in_time << [doris_jms_dwd__dwd_waybill_collect_intime,
                                        doris_jms_dwd__dwd_waybill_collect_intime_plan,
                                        doris_jms_dwd__dwd_waybill_collect_intime_taking_agg,
                                        doris_jms_dwd__dwd_waybill_collect_intime_plan_agg
                                        ] << jms_dm__dm_waybill_collect_intime_detail
